package practice7.controller;
import practice7.entity.R;
import practice7.entity.User;
import practice7.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
public class UserController {
    @Autowired
    UserService userService;
    @PostMapping("/register")
    public R register(@RequestBody User user){
        if (user.getNumber().equals("") || user.getPassword().equals("") ||user.getId().equals("")){
            System.out.println("用户名密码不能为空");
        }
        int res = userService.resigister(user);

        if (res == 205){
            System.out.println("用户名重复");
        }
        user.setPassword(null);
        return R.ok(user);
    }
}
